import 'package:car_map/page/groupingpage/grouping_router.dart';
import 'package:car_map/page/morepage/more_router.dart';
import 'package:car_map/page/routers/router_init.dart';
import 'package:car_map/page/squarepage/attractions_page/attractions_router.dart';
import 'package:car_map/page/squarepage/coffee_shop_page/coffee_router.dart';
import 'package:car_map/page/squarepage/square_router.dart';
import 'package:car_map/page/statisticspage/statistics_router.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';

import 'package:car_map/widget/widget_notfound.dart';

class Routes{

  static List<IRouterProvider> _listRouter=[];

  static void configureRoutes(Router router){

    //指定路由跳转错误返回页
    router.notFoundHandler=Handler(
      handlerFunc: (BuildContext buildContext,Map<String, List<String>> params){
        debugPrint("未找到目标页");
        return WidgetNotFound();
      }
    );

    _listRouter.clear();
    _listRouter.add(MoreRouter());
    _listRouter.add(StatisticsRouter());
    _listRouter.add(SquareRouter());
    _listRouter.add(GroupingRouter());
    _listRouter.add(CoffeeRouter());
    _listRouter.add(AttractionsRoutails());
    ///初始化路由
    _listRouter.forEach((routerProvider){
      routerProvider.initRouter(router);
    });

  }
}